impl Solution {
    pub fn hardest_worker(n: i32, logs: Vec<Vec<i32>>) -> i32 {
        let mut ans_id=logs[0][0];
        let mut max_duration=logs[0][1];
        for i in 1..logs.len() as usize{
            if logs[i][1]-logs[i-1][1] >max_duration{
                max_duration=logs[i][1]-logs[i-1][1];
                ans_id=logs[i][0];
            }else if logs[i][1]-logs[i-1][1] == max_duration{
                ans_id=logs[i][0].min(ans_id);
            }
        }
        ans_id
    }
}